function submit_dp(){
    $("#dianping").attr('disabled',false);
    var pinpai	= $('input[name="pinpai"]:checked').val();
    var fuwu	= $('input[name="fuwu"]:checked').val();
    var huanjing= $('input[name="huanjing"]:checked').val();
    // var jishu	= $('input[name="jishu"]:checked').val();
    // var xingjia = $('input[name="xingjia"]:checked').val();
    var hospid = $('#hospid').val();
    var neirong = $('#neirong').val();
    if(neirong.length > 140){
        alert("点评字数不能超过140");return false;
    }
    if(neirong.length < 2){
        alert("点评内容不能为空");return false;
    }
    neirong=encodeURIComponent(neirong);

    $.ajax({

        type: "post",
        url : "http://www.9191mr.com/hosp-"+hospid+"/dianping/?action=submit",
        dataType: "html",
        // data: 'pinpai='+pinpai+'&fuwu='+fuwu+'&huanjing='+huanjing+'&xingjia='+xingjia+'&jishu='+jishu+'&neirong='+neirong,
        data: 'pinpai='+pinpai+'&fuwu='+fuwu+'&huanjing='+huanjing+'&neirong='+neirong,
        timeout: 30000,
        success: function(data){

            if(data==1){
                alert('请先登录，然后再参与点评');return false;}
            else if(data==2){
                alert('您已经点评过该医院');return false;}
            else if(data==3){
                alert('点评成功');
                history.go(0);
                return false;}
        }
    });
}


function submit_doc_dp(){

    var pinpai	= $('input[name="pinpai"]:checked').val();
    var fuwu	= $('input[name="fuwu"]:checked').val();
    // var huanjing= $('input[name="huanjing"]:checked').val();
    var jishu	= $('input[name="jishu"]:checked').val();
    // var xingjia = $('input[name="xingjia"]:checked').val();
    var doctorid = $('#doctorid').val();

    var neirong = $('#neirong').val();
    if(neirong.length > 140){
        alert("点评字数不能超过140");return false;
    }
    if(neirong.length < 2){
        alert("点评内容不能为空");return false;
    }
    neirong=encodeURIComponent(neirong);

    $.ajax({

        type: "post",
        url : "http://www.9191mr.com/doctor-"+doctorid+"/dianping/?action=submit",
        dataType: "html",
        // data: 'pinpai='+pinpai+'&fuwu='+fuwu+'&huanjing='+huanjing+'&xingjia='+xingjia+'&jishu='+jishu+'&neirong='+neirong,
        data: 'pinpai='+pinpai+'&fuwu='+fuwu+'&jishu='+jishu+'&neirong='+neirong,
        timeout: 30000,
        success: function(data){

            if(data==1){
                alert('请先登录，然后再参与点评');return false;}
            else if(data==2){
                alert('您已经点评过该医生');return false;}
            else if(data==3){
                alert('点评成功');
                history.go(0);
                return false;}
        }
    });
}



function men(menid,contentid,overclass,outclass)
{
    var strindex=0;
    $(menid + " > a").each(function(i){
        $(this).mouseover(function(){
            if(strindex!=i){
                if(overclass!=""){
                    $($(menid + " > a")[strindex]).attr("class",outclass);
                    $(this).attr("class",overclass);
                }
                $($("div[id='" + contentid + "']")[strindex]).hide();
                $($("div[id='"+ contentid +"']")[i]).show();
                strindex=i;
            }
        });
    });

    if(overclass!=""){
        $($(menid + " > a")[strindex]).attr("class",overclass);
    }
    $($("div[id='" + contentid + "']")[strindex]).show();
}


function set_type(type){

    switch(type){

        case 'hosp':type=1;break;
        case 'doctor':type=2;break;
        case 'item':type=3;break;
        case 'cailiao':type=4;break;
        case 'price':type=5;break;
        case 'anli':type=6;break;
        case 'ask':type=7;break;
        default:type=1;break;
    }

    $("#type")[0].value = type;
    return false;
}

function search(){
    var rsp = $("#type").val();
    var wd = encodeURIComponent($("#sosuo").val());
    var rp = Date.parse(new Date()) / 1000;
    if(wd.length < 1){
        history.go(0);
        return false;
    }

    window.location="http://www.9191mr.com/search.php?rsp="+rsp+"&charset=utf-8&wd="+wd+"&rp="+rp+"&sign="+rp;
    return false;

}



function men_s(pos,classname,met){
    $(pos).bind(met,function(){
        if (!$(this).hasClass(classname)) {
            $(pos).removeClass(classname);
            $(this).addClass(classname);
        }
    })
}

function menu(n){
    var top_menu1 = document.getElementById('quanguo1');
    var top_menu2 = document.getElementById('quanguo2');
    if(n == 1){
        top_menu1.style.display="block";
        top_menu2.style.display="none";
    }else if(n == 2){
        top_menu1.style.display="none";
        top_menu2.style.display="block";
    }
}
function menu1(n){
    var top_menu1 = document.getElementById('zhuanti1');
    var top_menu2 = document.getElementById('zhuanti2');
    if(n == 1){
        top_menu1.style.display="block";
        top_menu2.style.display="none";
    }else if(n == 2){
        top_menu1.style.display="none";
        top_menu2.style.display="block";
    }
}
function menu2(n){
    var top_menu1 = document.getElementById('anli1');
    var top_menu2 = document.getElementById('anli2');
    if(n == 1){
        top_menu1.style.display="block";
        top_menu2.style.display="none";
    }else if(n == 2){
        top_menu1.style.display="none";
        top_menu2.style.display="block";
    }
}

function sendcode()
{
    var img=document.getElementById("img");
    img.src="/verify.php?d=" + Math.round(Math.random()*47842);
}

function sendquestion(){

    var qcontent= $('#qcontent').val();
    var qmobile	= $('#qmobile').val();
    var qname	= $('#qname').val();
    var qcode	= $('#qcode').val();
    var qreg	= $('#Reg_Key').val();
    if(qcode == ''){
        alert('请输入验证码');
        return false;
    }
    else if(qcontent == ''){
        alert('请填写您询问的内容');
        return false;
    }
    else if(qcontent.length > 500){
        alert('内容过长，请删减后提交');
        return false;
    }
    else if(qname =='' || qname.length >20){
        alert('请填写您的称呼');
        return false;

    }else if(qmobile ==''){
        alert('请填写您的手机号码，以便能及时回复您');
        return false;

    }else if(qmobile){

        var t=/^1[3458]\d{9}$/;
        if(t.test(qmobile) == false)
        {
            alert("请输入您有效的手机号码");
            return false;
        }
    }
    $.ajax({
        type: "post",
        url : "/jdask.php?reg="+qreg,
        dataType: "html",
        data: "qname="+encodeURIComponent(qname)+"&qcontent="+encodeURIComponent(qcontent)+"&qmobile="+qmobile+"&qcode="+qcode+"&qreg="+qreg,
        timeout: 30000,
        success: function(data){
            alert('收到'+data);return false;
            if(data==1){
                $(":input").attr("value","");
                alert('您的问题提交成功，我们会第一时间回复您！^_^');
                return false;
            }
            else if(data==2){
                $(":input").attr("value","");
                alert('您的问题已经提交，请耐心等待，我们会第一时间回复您！^_^');
                return false;
            }
            else if(data==3){
                alert('请填写正确的验证码！^_^');
                return false;
            }
            else{
                $(":input").attr("value","");
                alert('很抱歉，系统出现未知错误，请直接咨询客服');
                return false;
            }
        }
    });
}
function regmember(){
    var UserName= encodeURIComponent($('#UserName').val());
    var Sex		= $('#Sex').val();
    var Phone	= $('#Phone').val();
    var Mobile	= $('#Mobile').val();
    var Action	= $('#Action').val();
    var Reg_Key	= $('#Reg_Key').val();
    var hospid	= $('#hospid').val();
    var hospname= encodeURIComponent($('#hospname').val());
    var fromid	= $('#fromid').val();
    var fromcode= encodeURIComponent($('#fromcode').val());

    if(UserName == ''){
        alert('姓名不能为空');
        return false;
    }else if(Mobile == ''){
        alert('请填写手机号码，以便接收验证信息');
        return false;

    }else if(Mobile){

        var t=/^1[3458]\d{9}$/;
        if(t.test(Mobile) == false)
        {
            alert("请输入您有效的手机号码");
            return false;
        }
    }

    $.ajax({
        type: "post",
        url : "http://reg.9191mr.com/regdata.php",
        dataType: "html",
        data: "UserName="+UserName+"&Sex="+Sex+"&Phone="+Phone+"&Mobile="+Mobile+"&Action="+Action+"&Reg_Key="+Reg_Key+"&hospid="+hospid+"&hospname="+hospname+"&fromid="+fromid+"&fromcode="+fromcode,
        timeout: 30000,
        success: function(data){
            $(":input").attr("value","");
            alert('您的请求已被接收，审核通过后将享受经典整形网的会员权利！^_^');
            return false;

        }
    });
}

function chk_sj(){
    var chk_city = parseInt(document.getElementById('select3').value);
    if(chk_city==0){
        alert('请选择城市');return false;
    }
}

function chk_reg_js(form){

    var UserName	= form.UserName.value;
    var Mobile		= form.Mobile.value;
    if(UserName == ''){
        alert('姓名不能为空');
        return false;
    }else if(Mobile == ''){
        alert('请填写手机号码，以便接收验证信息');
        return false;

    }else if(Mobile){

        var t=/^1[3458]\d{9}$/;
        if(t.test(Mobile) == false)
        {
            alert("请输入您有效的手机号码");
            return false;
        }
    }
}



